package com.ccl.iot.dvr.utils;

/**
 * Created by HD on 2016/11/30.
 */

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


/**
 * 线程工具类
 */
public class ThreadUtils {


    private static ThreadUtils mInstance = null;
    private ExecutorService mThreadPool;

    private ThreadUtils() {
        mThreadPool = Executors.newFixedThreadPool(3);
    }

    public static ThreadUtils getInstance() {
        if (mInstance == null) {
            synchronized (ThreadUtils.class) {
                if (mInstance == null) {
                    mInstance = new ThreadUtils();
                }
            }
        }
        return mInstance;
    }

    public void submit(Runnable runnable) {
        mThreadPool.submit(runnable);
    }

}